#include <stdio.h>

int main()
{
    // 复合运算符
    int total = 1;
    // total = total + 5
    printf("total += 5, total = %d\n", total += 5);

    // total = total - 5
    printf("total -= 5, total = %d\n", total -= 5);
    
    // total = total * (12 + 6)
    printf("total *= 12 + 6, total = %d\n", total *= 12 + 6);
    
    // total = total / (total - 9)
    printf("total /= total - 9, total = %d\n", total /= total - 9);

    /*
    递增递减运算符 ++ 和 --
    前缀形式 ++a，表达式的值 = a + 1；a = a + 1
    后缀形式 a++，表达式的值 = a + 1；a = a + 1

    不要用到表达式里面，容易造成混乱
    int a = 1;
    */
    int a;
    printf("a++ = %d\n", a++);
    printf("a = %d\n", a);

    printf("++a = %d\n", ++a);
    printf("a = %d\n", a);

    printf("a-- = %d\n", a--);
    printf("a = %d\n", a);

    printf("--a = %d\n", --a);
    printf("a = %d\n", a);

    return 0;
}